package com.software.chemistry.service.Impl;

import com.software.chemistry.entity.TeacherInfo;
import com.software.chemistry.repository.TeacherRepository;
import com.software.chemistry.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
public class TeacherServiceImpl implements TeacherService {
    @Autowired
    private TeacherRepository teacherRepository;

    @Override
    public TeacherInfo findTeacherInfoByUserId(String userId) {
        Optional<TeacherInfo> optional = teacherRepository.findById(userId);
        TeacherInfo teacherInfo = optional.get();
        return teacherInfo;
    }

    @Override
    public TeacherInfo updateTeacherInfo(TeacherInfo teacherInfo) {
        TeacherInfo update = teacherRepository.save(teacherInfo);
        return update;
    }


}
